/*
    Carracci Systems - Carracci Server (openbam project)
    Copyright (C) 2007  Carracci Systems

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


package org.openbam.core.expr;

/**
 * AggregateExpressions is an expression that operates on a group of streaming values.
 */
public abstract class AggregateExpression extends Expression implements IExpression {

    protected IOperatingWindow operatingWindow;

    protected IExpression nestedExpression;

    /**
     * @return the operatingWindow
     */
    public IOperatingWindow getOperatingWindow() {
        return operatingWindow;
    }

    /**
     * @param operatingWindow the operatingWindow to set
     */
    public void setOperatingWindow(IOperatingWindow operatingWindow) {
        this.operatingWindow = operatingWindow;
    }

    /**
     * @return the nestedExpression
     */
    public IExpression getNestedExpression() {
        return nestedExpression;
    }

    /**
     * @param nestedExpression the nestedExpression to set
     */
    public void setNestedExpression(IExpression nestedExpression) {
        this.nestedExpression = nestedExpression;
    }

    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append(this.getName()).
                append("(").
                append(nestedExpression.toString()).
                append(")");

        return builder.toString();
    }

}
